﻿using System;
using System.Collections.Generic;

namespace DoNet.SFExpress.Framework.COM_RECE
{
    /// <summary>
    /// 基础通用API
    /// </summary>
    public class ComReceApi
    {
        #region 面单类接口

        #region 云打印面单打印插件接口 提供云打印面单打印插件的功能
        /*
        1.2 关键角色和步骤说明
        SCPPrint.js
        SCPPrint.js 是顺丰云打印封装的一个js包，提供打印方法给web系统调用，js-sdk下载地址：

        版本	下载地址	版本说明	更新时间
        1.0	https://scp-tcdn.sf-express.com/scp/jssdk/1.0/SCPPrint.js	第一个版本	
        1.1	https://scp-tcdn.sf-express.com/scp/jssdk/1.1/SCPPrint.js	增加设置打印机方法	
        1.2	https://scp-tcdn.sf-express.com/scp/jssdk/1.2/SCPPrint.js	解决异步加载js包延迟问题	
        1.3	https://scp-tcdn.sf-express.com/scp/jssdk/1.3/SCPPrint.js	支持自定义模板	
        1.4	https://scp-tcdn.sf-express.com/scp/jssdk/1.4/SCPPrint.js	解决证书问题，解决条形码空值问题	
        1.5	https://scp-tcdn.sf-express.com/scp/jssdk/1.5/SCPPrint.js	增加文本自适应特性	
        1.6	https://scp-tcdn.sf-express.com/scp/jssdk/1.6/SCPPrint.js	修复换行问题	
        1.7	https://scp-tcdn.sf-express.com/scp/jssdk/1.7/SCPPrint.js	修复汉字文本自适应问题	
        2.0	http://scp-tcdn.sf-express.com/prd/sdk/lodop/2.0/SCPPrint.js	优化批量打印性能	
        2.1	http://scp-tcdn.sf-express.com/prd/sdk/lodop/2.1/SCPPrint.js	支持A4纸打印	2023-04-07
        2.2	http://scp-tcdn.sf-express.com/prd/sdk/lodop/2.2/SCPPrint.js	修复内部接入场景下，并发批量打印可能会导致签名异常的问题	2023-05-15
        2.3	http://scp-tcdn.sf-express.com/prd/sdk/lodop/2.3/SCPPrint.js	1.优化文本自适应 2.支持面单批量预览(每次6张)	2023-05-19
        2.4	http://scp-tcdn.sf-express.com/prd/sdk/lodop/2.4/SCPPrint.js	1. 优化lodop未安装提示文案(增加部用户安装渠道提示)
        2. 支持一次预览全部面单
        3. 文本元素支持动态字号和动态黑底
        4.文本元素支持自定义水平和垂直对齐方式	2023-08-24
        2.5	https://scp-tcdn.sf-express.com/prd/sdk/lodop/2.5/SCPPrint.js	修复某些极端环境下字号缩放失效，导致三段码和收件人打印字体很小的问题	2023-10-23
        2.6	https://scp-tcdn.sf-express.com/prd/sdk/lodop/2.6/SCPPrint.js	针对在oms中无法查询到的运单开放1.0打印形式(支持用户传具体面单信息)	2023-12-01
        2.7	https://scp-tcdn.sf-express.com/prd/sdk/lodop/2.7/SCPPrint.js	1、sdk支持面单接口调用失败重试，提升打印稳定性(重试3次，间隔1s);
        2、在控制台添加打印耗时日志，方便后续定位打单慢问题;
        3、优化批量任务并发逻辑，减少大批量打单总体耗时	2024-08-26
        建议下载使用，下载时请勿直接复制，点击另存为即可

        sdk如何使用参考下面的 SDK使用说明

        token注册
        token注册，需要客户的后端系统使用接入码和校验码，调用丰桥网关接口获取token,token有限期为2小时。获取方法参考：OAuth2认证说明

        打印插件
        需要客户在电脑安装打印插件，如过客户电脑插件已经安装过clodop打印插件，可不需要安装，插件下载地址：
        https://scp-tcdn.sf-express.com/scp/soft/SCPPrint_Win32NT_6.570CN.exe

        2.SDK使用说明
        2.1 初始化
        创建实例：new SCPPrint(options);//注意只需要创建一次实例，多次调用需要共用该实例，否则可能出现乱序问题
        options: {partnerID: 'xxx'}
        序号	参数列表	类型	是否必传	含义
        1	partnerID	String	是	合作伙伴编码（即顾客编码）
        2	env	String	否	生产：pro；沙箱：sbox。不传默认生产
        3	notips	Booleans	否	是否需要sdk的弹窗提示，默认是
        4	callback	Function	否	实例化后获取lodop结果
        callback：(result)=>{}
        result包含以下信息

        序号	参数列表	类型	含义
        1	code	Number	包含1、2、3，具体查看2.3code标识说明
        2	msg	String	错误提示
        3	downloadUrl	String	code为2和3时返回，打印插件下载地址
        2.2 调用SDK方法
        2.2.1 print(data, callback, options)
        调用打印或者预览

        序号	参数列表	类型	是否必传	含义
        1	data	Object	是	参数
        2	callback	Function	否	回调函数，SDK在打印任务推送成功后调用
        3	options	Object	否	配置
        data: {}

        序号	参数列表	类型	是否必传	含义
        1	requestID	String	是	请求唯一ID,方便定位问题
        2	accessToken	String	是	网关获取的token(有效期 2h)
        3	templateCode	String	是	模板编码，关联云打印接口后，点击查看，可在接口详情页获取模板编码，类似：fm_76130_standard_{partnerId}
        4	documents	Array	是	业务数据，支持批量,字段定义参考下方模板固定字段
        5	customTemplateCode	String	否	自定义模板编码，当需要使用模板编辑器编辑自定义区时，将自定义模板编码赋值该字段 自定义模板必须是已发布的，且规格要和需要打印的模板对应
        6	extJson	Json	否	扩展字段 字段定义参考下方extJson字段
        7	version	String	否	版本号， 2.0或者1.0，默认2.0（推荐）
        2.0方式只需要提供单号等关键信息
        1.0方式，面单所有信息都需要提供
        模板固定字段 documents [{}]

        固定字段名	类型	必 传	描述	值说明
        masterWaybillNo	String	是	主运单号	
        branchWaybillNo	String	否	子运单号	单票运单时不填
        backWaybillNo	String	否	签回单号	打印签回单时，masterWayBillNo和branchWaybillNo为空
        seq	String	否	该运单号打印时对应的顺序号，母运单序号=1，子运单号时递增该值	单票运单时不填，当打印子母单时必填
        sum	String	否	子母件运单总数	单票运单时不填，当打印子母单时必填
        isPrintLogo	String	否	如热敏贴纸上已印刷LOGO及服务电话则不需打印。如未印刷则需打印。 true:热敏纸上无印刷需要打印	不需要打印则不填
        remark	String	否	自定义区域备注	
        waybillNoCheckType	String	否	运单号权限校验类型 1：收方电话后6位 2：寄方电话后6位 优先校验客户编码，如果客户编码校验不通过，才使用其他方式校验 比如：“1”	第三方erp对接时，为必传，无法通过客户接入码校验运单号时，可以通过其他方式校验。
        waybillNoCheckValue	String	否	运单号合法校验具体值 比如：“123456”	与 waybillNoCheckType 参数对应
        customData	Json	否	使用自定义模板编码时，对应的变量字段，如果没有使用变量字段，可以不传	注意字段类型是Json对象
        optionalJson	Json	否	此字段只给医药渠道运单使用，可以不传，注意是JSON对象，内容如下：“optionalJson”:{“lineId”:排线ID, “monthlyCard”:月结卡号}	注意：lineId传Long类型，monthlyCard传String类型，非必填
        printPageNum	String	否	打印页码，eg: 第 10/20 票	调用方需注意传值长度，最多只能打印下"第 1000/2000 票"文本的长度。2024-06-06后新增，当前仅引用公共模板76130-v2.21版本及以上、76165一联V1.7版本及以上、76165二联V1.8版本及以上的模板支持。
        isPrintStub	String	否	是否打印存根联，不打印存根联不传	true：打印存根联。不传或传false：不打印存根联。2024-08-22后新增，当前仅引用76*130公共模板2.24版本及以上的业务模板才生效。
        flowIcon	String	否	【特经项目】流向标识。传"1"打数字1图标，依次类推，当前最大支持15。	支持传值范围：“1”-“15”，对应数字1到15的图标。2024-08-29后新增，仅引用76130公共模板V2.25版本及以上；76165一联公共模板V1.18版本及以上；76*165二联公共模板V2.0版本及以上的业务模板才生效。
        extJson字段 extJson{}

        固定字段名	类型	必 传	描述	值说明
        channel	String	否	订单所属渠道	eg: “medicine” 代表医药渠道运单,“cx” 代表是CX预约单
        encryptFlag	String	否	自定义脱敏标识，6位0和1和2组成的字符串，0表示不脱敏，1表示需要脱敏，2表示隐藏（只对公司名生效）；顺序：
        第1位：收件人姓名（只能脱敏或显示），
        第2位：寄件人姓名（只能脱敏或显示），
        第3位：收件人地址（只能脱敏或显示），
        第4位：寄件人地址（只能脱敏或显示），
        第5位：收件人公司名称（只能隐藏或显示），
        第6位：寄件人公司名称（只能隐藏或显示）	eg: “101020” 表示收件人姓名和收件人地址脱敏，寄件人姓名和寄件人地址不脱敏,同时隐藏收件人公司名
        地址脱敏规则：后10位，如果有阿拉伯数字、中文数字、字母就用*替换
        姓名脱敏规则：1个字的 不隐藏，2个字的 隐藏末位，3个字的 隐藏中间，超过三个字，超过部分不打印，隐藏第三位，如欧阳娜娜-欧阳*
        手机号脱敏规则：保留前1位和后4位 eg: 1*2345
        callback：(result)=>{}
        result包含以下信息

        序号	参数列表	类型	含义
        1	code	Number	查看2.3code标识说明
        2	msg	String	错误提示
        3	downloadUrl	String	code为2和3时返回，打印插件下载地址
        4	apiResultCode	String	code为12时返回，丰桥网关返回结果代码
        options: {}

        序号	参数列表	类型	是否必传	含义
        1	lodopFn	String	否	PRINT,PREVIEW；不传默认PRINT。批量打印使用预览弹窗不打印会中断后续打印并返回错误码15
        2	allPreview	Boolean	否	true,false；不传默认false。传true可一次预览全部面单(V2.4开始支持)
        3	pageType	String	否	A4,A4_copy；不传打印默认面单尺寸。传A4面单会在A4纸上排列。A4_copy用于留底功能使用，可在一张A4上打印两张相同面单(V2.1开始支持)
        2.2.2 getPrinters()
        获取打印机列表，调用sdk实例化对象的getPrinters方法，示例如下

        let printers = [];
        const callback = (result) => {
           if (result.code === 1) {
              printers = result.printers;
           }
        };
        printSdk.getPrinters(callback);
        callback返回值

        序号	参数列表	类型	含义
        1	code	String	包含1、2、3，具体查看2.3code标识说明
        2	msg	String	错误提示
        3	downloadUrl	String	code为2和3时返回，打印插件下载地址
        3	printers	Array	code为1时返回，打印机列表
        printers

        序号	参数列表	类型	含义
        1	index	Number	打印机序号
        2	name	String	打印机名称
        2.2.3 setPrinter(printer)
        设置打印机，如不设置则使用默认打印机，输入getPrinters获取到的打印机index或者name，示例如下

        printSdk.setPrinter(printer);
        序号	参数列表	类型	是否必传	含义
        1	printer	String	是	打印机序号或者名称
        2.3 code标识说明
        标识	说明	sdk处理	处理建议
        0	必传参数缺失		
        1	成功		
        2	打印插件未安装	弹窗提示安装	notips为true可屏蔽弹窗
        3	打印插件版本需升级	弹窗提示升级	notips为true可屏蔽弹窗
        4	SDK正在加载	弹窗提示“网页还没下载完毕，请稍等一下再操作。”	notips为true可屏蔽弹窗
        11	丰桥服务异常或网络故障	系统确认弹窗是否尝试重新打印	
        12	丰桥服务结果非成功返回	apiResultCode等于’A1005’, ‘A1007’, ‘A1008’, ‘A1009’, 'A1099’时弹窗是否尝试重新打印[标识说明]	‘A1001’,‘A1002’,‘A1003’,‘A1004’,'A1011’请自行处理
        13	业务接口错误（例如运单查询无数据)	系统确认弹窗是否尝试重新打印	
        14	推送打印机失败	系统确认弹窗是否尝试重新推送打印	
        15	预览未推送打印		自行根据业务场景处理
        2.4 调用demo展示
        点击下面连接打开页面，右键点击【另存为】保存到本地，修改格式为html
        https://qiao.sf-express.com/doc/download/laas/cloudprint/demo.txt

        2.5 报文示例（documents参数）
        请求报文1:单票传值举例

        {
            "documents": [{
            "masterWaybillNo": "SF1234567890999"
            }]
        }
        请求报文2:签回单传值举例

        {
 	        "documents": [{
	        "masterWaybillNo":"SF1234567890999"},
	        {
	        "backWaybillNo":"SF1234567890666"}
	        ]
        }
        请求报文3:子母单场景传值举例

        {
 	        "documents": [{
	        "masterWaybillNo":"SF1234567890999",
	        "seq":"1",
	        "sum":"3"},
	        {
	        "masterWaybillNo":"SF1234567890999",
	        "branchWaybillNo":"SF2234567890100",
	        "seq":"2",
	        "sum":"3"},
	        {
	        "masterWaybillNo":"SF1234567890999",
	        "branchWaybillNo":"SF2234567890101",
	        "seq":"3",
	        "sum":"3"}
        ]
        请求报文4:使用自定义模板编辑器场景传值举例

        {
            "customTemplateCode":"fm_76130_standard_custom_10000022213_1",
            "documents": [{
            "masterWaybillNo": "SF1234567890999",
            "customData":{"var123":"自定义变量内容"}
            }]
        } 
        */
        #endregion 云打印面单打印插件接口 提供云打印面单打印插件的功能

        #region 云打印面单转PDF接口

        /// <summary>
        /// 云打印面单转PDF接口 
        /// 该接口提供给用户自主打单的服务，提供异步和同步返回面单pdf文件方式。
        /// 异步方式： 面单pdf文件会直接推送到用户配置的回调地址，文档后半部分(2.8)提供面单推送的格式及解码出面单pdf文件的示例
        /// 同步方式： 不需要配置回调地址，接口会同步返回面单pdf文件的url地址，下载时需要请求头携带对应token
        /// 云打印面单打印2.0接口：是原来面单打印接口的升级版本，主要在业务参数做了简化，去掉了复杂的业务字段，用户只需要提供运单号等关键字段即可，云打印会查询订单系统的订单数据。
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudPrintWaybills(string partnerID, string checkword, MsgDataRequestCloudPrintWaybills data, string accessToken = "", string environment = "bspgw")
        {
            /*	
            2.6. 请求示例\应用场景(JSON)示例
            请求报文1:单票传值举例（msgData字段）:

            {
                "templateCode": "fm_210_standard_{{clientcode}}",
                "version":"2.0",
                "fileType":"pdf",
                "sync":true,
                "documents": [{
                "masterWaybillNo": "SF1234567890999"
                }]
            }
            请求报文2:签回单传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "fileType":"pdf",
                    "sync":true,
                "documents": [{
                "masterWaybillNo":"SF1234567890999"},
                {
                "backWaybillNo":"SF1234567890666"}
                ]
            }
            请求报文3:子母单场景传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "fileType":"pdf",
                    "sync":true,
                "documents": [{
                "masterWaybillNo":"SF1234567890999",
                "seq":"1",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890100",
                "seq":"2",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890101",
                "seq":"3",
                "sum":"3"}
            ]
            请求报文4:使用自定义模板编辑器场景传值举例

            {
                "templateCode": "fm_76130_standard_{{clientcode}}",
                "customTemplateCode":"fm_76130_standard_custom_10000022213_1",
                "version":"2.0",
                "fileType":"pdf",
                "sync":true,
                "documents": [{
                "masterWaybillNo": "SF1234567890999",
                "customData":{"var123":"自定义变量内容"}
                }]
            }
            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	String	失败提示信息
            3	errorCode	String	失败状态码
            4	requestId	String	发送请求中的ID,原封不动返回，使客户系统能识别出哪个请求对应的响应
            5	obj	object	同步方式才有值，异步方式为空对象
            obj
            #	属性名	类型	说明
            1	files	List<PrintFile>	pdf文件集合,不保证顺序，自行通过seqNo排序
            2	clientCode	String	客户编码
            3	templateCode	String	模板编码
            4	fileType	String	文件类型(pdf)
            PrintFile
            #	属性名	类型	说明
            1	url	String	pdf文件的url下载地址,使用 GET 协议
            2	token	String	下载文件时需要的token,设置在请求头的 X-Auth-token 字段，有效期 24h
            3	waybillNo	String	顺丰运单号（子母单为子单号）
            4	seqNo	int	面单序号（批量打印场景，为documents的序号）
            5	areaNo	int	联编号（大客户面单为固定值：1）
            6	pageNo	int	每联的页号(大客户面单为固定值：1)
            7	pageCount	int	文件的页数
            2.7. 返回示例\应用场景(JSON)示例
            响应报文:

            成功响应-同步:
            {
                "apiErrorMsg": "",
                "apiResponseID": "000189F87B1B193FE3DE5E798D07183F",
                "apiResultCode": "A1000",
                "apiResultData": "{\"obj\":{\"clientCode\":\"SLKJNH0b5Xc\",\"fileType\":\"pdf\",\"files\":[{\"areaNo\":1,\"documentSize\":0,\"pageCount\":0,\"pageNo\":1,\"seqNo\":1,\"token\":\"AUTH_tkv12_f146d1855480549d262b5c46ab0a***c608f9725bcd2\",\"url\":\"https://eos-scp-core-shenzhen-futian1-oss.sf-express.com:443/v1.2/AUTH_EOS-SCP-CORE/print-file/SLKJ***b5Xc_dqx-test-06102056_SF1687***931891_fm_76130_standard_SLKJ***b5Xc_1_1_1.pdf\",\"waybillNo\":\"SF1687***931891\"}],\"templateCode\":\"fm_76130_standard_SLKJ***b5Xc\"},\"requestId\":\"dqx-test-06102056\",\"success\":true}"
            }

            成功响应-异步:
             {
                "apiErrorMsg": "",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1000",
                "apiResultData": "{\"requestId\": \"123\",\"success\": true}"
            }

            失败响应：
            {
                "apiErrorMsg": "auth_error:partnerID:test010d_is_not_exist",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1011",
                "apiResultData": "{***}"
            }
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明	【处理建议】
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果	
            A1001	必传参数不可为空	serviceCode partnerID requestID timestamp msgDigest msgData 不可为空
            A1002	请求时效已过期	时效参考auth2 https://open.sf-express.com/customerService/395002?interId=590549&faqId=4
            A1003	IP无效	参考常见问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=590549&faqId=2
            A1004	无对应服务权限	联系销售经理，配置权限
            A1005	流量受控	测试环境流量限制为5000，请不要在测试环境做压测
            A1006	数字签名无效	参考常见问题 签名加解密问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=795986
            A1007	重复请求	过一分钟在尝试
            A1008	数据解密失败	
            A1009	目标服务异常或不可达	
            A1099	系统异常	
            3.2 业务异常代码 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_PRINT_WAYBILLS";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudPrintWaybills>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// 云打印面单转PDF接口（CloudPrintWaybills 异步时 面单pdf文件推送）
        /// 此接口用于云打印文件推送，将文件推送给客户配置的回调地址，
        /// </summary>
        /// <param name="body"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <returns></returns>
        public static MsgDataResponseCloudPrintWaybillsAsyn CloudPrintWaybillsAsyn(string body, out MsgDataRequestCloudPrintWaybillsAsyn msgData)
        {
            /*	
            2.8. 面单pdf文件推送说明
            同步方式请求接口时不需要关注此部分内容
            此接口用于云打印文件推送，将文件推送给客户配置的回调地址，

            2.8.1接口基本信息
            接口类型	推送
            请求方式	SF请求CP
            接口方式	HTTP /HTTPS POST Content_type:application/x-www-form-urlencoded; Charset=utf-8
            接口服务码	COM_PUSH_CLOUD_PRINT_WAYBILLS
            2.8.2 元素<请求>Resquest
            参数列表	类型	是否必传	含义
            logisticID	String(20)	Y	物流公司代码，SF代表顺丰
            requestID	String(40)	Y	请求唯一号UUID
            serviceCode	String(50)	Y	接口服务代码 此处为面单推送接口服务码
            timestamp	long	Y	调用接口时间戳
            msgDigest	String(128)	Y	数字签名 同CP请求SF的加密方式相同
            msgData	String	Y	业务数据报文
            nonce	String	N	调用接口随机数
            2.8.4 元素<响应>Response
            #	属性名	类型（约束	必填	默认值	描述
            1	success	String(10)	是		是否成功接收 true:是，false:否
            2	msg	String(200)	否		接收失败异常描述
            2.8.5报文范例
            content是文件的内容，先base64.decode()解密得到byte[]，再转换成文件

            {    
                "content": "ADWqad321ad=qqawd12542",    
                "fileName": "*_20190915152030.pdf",    
                "waybillNo": "432135131355",    
                "fileType": "pdf",    
                "seqNo": "1111",    
                "areaNo": "1",    
                "pageNo": "1",    
                "templateCode": "xxx"
            }
            复制代码
            解码示例

            String message = "{\"content\":\"xxx\", \"fileType\":\"pdf\"}";
            String content = JSON.parseObject(message).getString("content");
            Base64Encoder base64Encoder = new Base64Encoder();
            byte[] fileBytes= base64Encoder.decode(content);
            Files.write(Paths.get("path.pdf"), fileBytes);
            复制代码
            2.8.6.响应报文
            成功

            {    "success": "true",    "msg": ""}
            复制代码
            失败

            {    "success": "false",    "msg": "xxx"}
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明	【处理建议】
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果	
            A1001	必传参数不可为空	serviceCode partnerID requestID timestamp msgDigest msgData 不可为空
            A1002	请求时效已过期	时效参考auth2 https://open.sf-express.com/customerService/395002?interId=590549&faqId=4
            A1003	IP无效	参考常见问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=590549&faqId=2
            A1004	无对应服务权限	联系销售经理，配置权限
            A1005	流量受控	测试环境流量限制为5000，请不要在测试环境做压测
            A1006	数字签名无效	参考常见问题 签名加解密问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=795986
            A1007	重复请求	过一分钟在尝试
            A1008	数据解密失败	
            A1009	目标服务异常或不可达	
            A1099	系统异常	
            3.2 业务异常代码 
            */
            MsgDataResponseCloudPrintWaybillsAsyn result = new MsgDataResponseCloudPrintWaybillsAsyn()
            {
                success = "false",
                msg = "失败"
            };

            if (!string.IsNullOrEmpty(body))
            {
                var reqData = JsonHelper.DeserializeObject<CloudPrintWaybillsAsynRequest>(body);
                if (reqData != null)
                {
                    msgData = JsonHelper.DeserializeObject<MsgDataRequestCloudPrintWaybillsAsyn>(reqData.msgData);
                    result = new MsgDataResponseCloudPrintWaybillsAsyn()
                    {
                        success = "true",
                        msg = ""
                    };
                }
                else
                {
                    msgData = null;
                }
            }
            else
            {
                msgData = null;
            }
            return result;
        }

        #endregion 云打印面单转PDF接口

        /// <summary>
        /// 云打印面单转指令接口 
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudPrintCommand(string partnerID, string checkword, MsgDataRequestCloudPrintCommand data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            请求报文1:单票传值举例（msgData字段）:

            {
                "templateCode": "fm_210_standard_{{partnerId}}",
                "version":"2.0",
                "fileType":"command",
                "documents": [{
                "masterWaybillNo": "SF1234567890999"
                }]
            }
            请求报文2:签回单传值举例

            {
                    "templateCode": "fm_210_standard_{{partnerId}}",
                "documents": [{
                "masterWaybillNo":"SF1234567890999"},
                {
                "backWaybillNo":"SF1234567890666"}
                ]
            }
            请求报文3:子母单场景传值举例

            {
                    "templateCode": "fm_210_standard_{{partnerId}}",
                "documents": [{
                "masterWaybillNo":"SF1234567890999",
                "seq":"1",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890100",
                "seq":"2",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890101",
                "seq":"3",
                "sum":"3"}
            ]
            请求报文4:使用自定义模板编辑器场景传值举例

            {
                "templateCode": "fm_76130_standard_{{clientcode}}",
                "customTemplateCode":"fm_76130_standard_custom_10000022213_1",
                "documents": [{
                "masterWaybillNo": "SF1234567890999",
                "customData":{"var123":"自定义变量内容"}
                }]
            }
            请求报文5:单票 返回txt文件

            {
                "requestId":"123",
                "templateCode": "fm_210_standard_eos-scp-core",
                "documents": [{
                "masterWaybillNo": "SF1234567890999"
                }],
                "extJson": {
                    "commandType": "cpcl",
                    "commandFileType": "url"
                },
            }
            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	String	失败提示信息
            3	errorCode	String	失败状态码
            4	requestId	String	发送请求中的ID,原封不动返回，使客户系统能识别出哪个请求对应的响应
            5	obj	object	同步方式才有值
            obj
            #	属性名	类型	说明
            1	files	List<CommandContentFile>/List<PrintFile>	模板指令集集合，默认指令字符串List<CommandContentFile>，指定返回txt文件则为List<PrintFile>
            2	clientCode	String	客户编码
            3	templateCode	String	模板编码
            4	fileType	String	文件类型(command)
            CommandContentFile
            #	属性名	类型	说明
            1	contents	List<CommandContent>	具体某一单的不同联的指令集集合
            2	waybillNo	String	顺丰运单号（子母单为子单号）
            CommandContent
            #	属性名	类型	说明
            1	area	String	联的名称，联的定义：master:主运单联, dditional:附加联, stub:存根联, receipt:发票联, custom:自定义联
            1	content	String	该联的指令集
            PrintFile
            #	属性名	类型	说明
            1	url	boolean	pdf文件的url下载地址,使用 GET 协议
            2	token	string	下载文件时需要的token,设置在请求头的 X-Auth-token 字段，有效期 24h
            3	waybillNo	string	顺丰运单号（子母单为子单号）
            4	seqNo	int	面单序号（批量打印场景，为documents的序号）
            5	areaNo	int	联编号（大客户面单为固定值：1）
            6	pageNo	int	每联的页号(大客户面单为固定值：1)
            7	documentSize	int	批量打印时，入参documents的运单数
            8	pageCount	int	pdf文件的总页数
            2.7. 返回示例\应用场景(JSON)示例
            响应报文1 指令文本:

            成功响应:
             {
                "apiErrorMsg": "",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1000",
                "apiResultData": "obj"
            }

            obj
            {
                "obj": {
                    "clientCode": "{{partnerId}}",
                    "fileType": "command",
                    "files": [
                        {
                            "contents": [
                                {
                                    "area": "master",
                                    "content": "! 0 200 200 988 1\nPAGE-WIDTH 577\nLEFT\nRIGHT\nSETBOLD 1\nSETMAG 3 3\nTEXT 24 0 0 7 T 标快\nSETMAG 1 1\nLEFT\nSETBOLD 0\nTEXT 55 0 15 81  已验视\nLEFT\nSETBOLD 0\nTEXT 55 0 152 81 SCP  1  2023-05-29 09:27:59\nLEFT\nSETBOLD 0\nLEFT\nSETBOLD 0\nLEFT\nLEFT\nSETBOLD 1\nTEXT 24 0 144 195 运单号 SF 130 621 070 5614\nLEFT\nLINE 23 225 567 225 1\nLEFT\nLINE 23 280 567 280 1\nLEFT\nLINE 23 356 567 356 1\nLEFT\nLINE 23 543 567 543 1\nLEFT\nLINE 23 225 23 935 1\nLEFT\nLINE 565 225 565 935 1\nLEFT\nLINE 366 358 366 543 1\nLEFT\nLINE 23 684 567 684 1\nLEFT\nLINE 296 684 296 835 1\nLEFT\nLINE 23 734 567 734 1\nLEFT\nLINE 23 784 567 784 1\nLEFT\nLINE 23 835 567 835 1\nLEFT\nLINE 23 933 567 933 1\nLEFT\nSETBOLD 0\nTEXT 24 0 34 685 Payment 付款方式：\nTEXT 24 0 34 712 寄付现结\nLEFT\nSETBOLD 0\nLEFT\nSETBOLD 0\nLEFT\nSETBOLD 0\nTEXT 24 0 34 735 ActualWT 实际重量：1.0k\nTEXT 24 0 34 762 g\nLEFT\nSETBOLD 0\nTEXT 24 0 296 735 DeclaredValue 申报价值\nTEXT 24 0 296 762 1.0\nLEFT\nSETBOLD 0\nLEFT\nSETBOLD 0\nLEFT\nSETBOLD 1\nSETMAG 6 5\nTEXT 55 0 30 212 755W-BE\nSETMAG 1 1\nRIGHT\nSETBOLD 1\nSETMAG 6 5\nSETMAG 1 1\nLEFT\nLEFT\nSETBOLD 0\nSETMAG 4 4\nSETMAG 1 1\nLEFT\nLEFT\nSETBOLD 0\nSETMAG 2 2\nTEXT 55 0 91 360 李四 \nSETMAG 1 1\nLEFT\nSETBOLD 0\nSETMAG 2 2\nTEXT 55 0 91 396 1*6666\nSETMAG 1 1\nLEFT\nSETBOLD 0\nTEXT 24 0 38 410 广东省深圳市龙华区樟坑二\nTEXT 24 0 38 437 区\nLEFT\nLEFT\nSETBOLD 0\nTEXT 55 0 38 543 From 张*   1*6666  广东省深圳市罗湖区东(门北)路翠兰楼14H\nLEFT\nSETBOLD 1\nSETMAG 6 5\nTEXT 55 0 30 579 D7\nSETMAG 1 1\nLEFT\nLEFT\nLEFT\nLEFT\nSETBOLD 0\nTEXT90 24 0 0 467 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT90 24 0 0 700 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT90 24 0 0 928 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT90 24 0 551 467 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT90 24 0 551 700 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT90 24 0 551 928 SF1306210705614\nLEFT\nSETBOLD 0\nTEXT 24 0 34 838 Description 托寄物：\nTEXT 24 0 34 865 物品A\nEG 63 96 45 102 FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8FE381E001FC7FE3801C01FC01E38FFC7FFC781F8FFC0F03F81C00FC7FE0781C07E00703C01E07E03F01C001C71FFF0FF8FE0781FF8FC0F1FF81FC01FF8E3F8\nEG 9 70 30 374 00000007ff800000000000007ffff8000000000003ffffff00000000000fe0001fc0000000003f000003f000000000f80000007c00000001e00000001e00000007c00000000f8000000f0000000003c000001e0000000001e000003c0000000000f00000780000000000780000f000000000003c0001e000000000001e0001c000000000000e000380000000000007000700000000000003800700000002000003800e00001c07000001c00c00001c07000000c01c00001c07000000e01800181c07000000603800181c06000000703800181c0ffff000703000181c0ffff800307000181c0ffff800387000181c1c038000386000181c1c038000186000181c3803800018e000181c380380001ce000181c780380001ce000181c7c0380001ce000181cfc0300001ce000181dfe0700001ce000181dce0700001ce000181c8e0700001ce000181c070e00001ce000181c078e00001ce000181c038e00001ce000181c03dc00001ce000181c01fc00001c6000187c00f800001860001ffc00f800001870003ffc007800003870003f1c00fc0000383000301c01fe0000303800001c03de0000703800001c078f0000701800001c1f07c000601c00001c3e03e000e00c00001cf801f000c00e00001df000f801c00700001cc0003803800700000c800010038003800000000000070001c000000000000e0001e000000000001e0000f000000000003c00007800000000007800003c0000000000f000001e0000000001e000000f0000000003c0000007c00000000f80000001e00000001e00000000f80000007c000000003f000003f0000000000fe0001fc00000000003ffffff0000000000007ffff800000000000007ff80000000\nEG 24 192 360 360 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001FFFFFFFF803E0003FE00003E0FFFFE0F8001FFFFFFFF8001FFFFFFFF803E0003FE00003E0FFFFE0F8001FFFFFFFF8001FFFFFFFF803E0003FE00003E0FFFFE0F8001FFFFFFFF8001FFFFFFFF803E0003FE00003E0FFFFE0F8001FFFFFFFF8001FFFFFFFF803E0003FE00003E0FFFFE0F8001FFFFFFFF8001F000000F87FE0FFC01FF8001FFFC01F07FE1F000000F8001F000000F83FE0FFC01FF8001FFFC01F07FC1F000000F8001F000000F83FE0FFC01FF8001FFFC01F07FC1F000000F8001F000000F83FE0FFC01FF8001FFFC01F07FC1F000000F8001F000000F83FE0FFC01FF8001FFFC01F07FC1F000000F8001F07FFE0F803FFF803FFF83C00FFFFE0F8001F07FFE0F8001F07FFE0F803FFF803FFF83C00FFFFE0F8001F07FFE0F8001F07FFE0F803FFF803FFF83C00FFFFE0F8001F07FFE0F8001F07FFE0F803FFF803FFF83C00FFFFE0F8001F07FFE0F8001F07FFE0F803FFF803FFF87C00FFFFF0F8001F07FFE0F8001F07FFE0F83FE0F83FFF07FC1F003FFF00001F07FFE0F8001F07FFE0F83FE0F83FFF07FC1F003FFF00001F07FFE0F8001F07FFE0F83FE0F83FFF07FC1F003FFF00001F07FFE0F8001F07FFE0F83FE0F83FFF07FC1F003FFF00001F07FFE0F8001F07FFE0F8001F0FC000F87FF0F83E00003C1F07FFE0F8001F07FFE0F8001F07C000F83FE0F83C00003C1F07FFE0F8001F07FFE0F8001F07C000F83FE0F83C00003C1F07FFE0F8001F07FFE0F8001F07C000F83FE0F83C00003C1F07FFE0F8001F07FFE0F8001F07C000F83FE0F83C00003C1F07FFE0F8001F000000F83C1F007C1FFFC00007C01FFFFC1F000000F8001F000000F83C1F003C1FFFC00007C01FFFFC1F000000F8001F000000F83C1F003C1FFFC00007C01FFFFC1F000000F8001F000000F83C1F003C1FFFC00007C01FFFFC1F000000F8001F000000F83C1F003C1FFFC00007C01FFFFC1F000000F8001FFFFFFFF83C1F07C3E0F83E1F07C3E0F83C1FFFFFFFF8001FFFFFFFF83C1F07C3E0F83C1F07C3E0F83C1FFFFFFFF8001FFFFFFFF83C1F07C3E0F83C1F07C3E0F83C1FFFFFFFF8001FFFFFFFF83C1F07C3E0F83C1F07C3E0F83C1FFFFFFFF8001FFFFFFFF83C1F07C3E0F83E1F07C3E0F83C1FFFFFFFF8000000000000000007C000F803FFFFFC00F83C0000000000000000000000000007C000F803FFFFFC00F83C0000000000000000000000000007C000F803FFFFFC00F83C0000000000000000000000000007C000F803FFFFFC00F83C0000000000000000000000000007C000F803FFFFFE00F87E0000000000001FFFFFE0FFFFFF07FFFF07FC1F0003FF07C3E0F83C1F00001FFFFFE0FFFFFF07FFFF07FC1F0003FF07C3E0F83C1F00001FFFFFE0FFFFFF07FFFF07FC1F0003FF07C3E0F83C1F00001FFFFFE0FFFFFF07FFFF07FC1F0003FF07C3E0F83C1F0000000FC3FF0FFE0000000007FFF007FFFFF80000F8000000000007C3FF07FC0000000007FFE007FFFFF80000F8000000000007C3FF07FC0000000007FFE007FFFFF80000F8000000000007C3FF07FC0000000007FFE007FFFFF80000F8000000000007C3FF07FC0000000007FFE007FFFFF80000F80000000000FFC3FFFFFC1FFFFC1F00001F0003FF07C000FFC3E0F80000FFC3FFFFFC1FFFFC1F00001F0003FF07C000FFC3E0F80000FFC3FFFFFC1FFFFC1F00001F0003FF07C000FFC3E0F80000FFC3FFFFFC1FFFFC1F00001F0003FF07C000FFC3E0F80000FFC3FFFFFC1FFFFC1F00001F0003FF07C000FFC3E0F8000007FC0007FFE0F803E0007E1FF8000007FFE0F8001F00000007FC0007FFE0F803E0003C1FF8000007FFE0F8001F00000007FC0007FFE0F803E0003C1FF8000007FFE0F8001F00000007FC0007FFE0F803E0003C1FF8000007FFE0F8001F00000007FE0007FFE0F803E0007C1FF8000007FFE0F8001F000000FFFFE0FFC000F83FE0FFFC1F003FFF00001F07FFE0000000FFFFE0FFC000F83FE0FFFC1F003FFF00001F07FFE0000000FFFFE0FFC000F83FE0FFFC1F003FFF00001F07FFE0000000FFFFE0FFC000F83FE0FFFC1F003FFF00001F07FFE0000000FFFFE0FF8000F87FE0FFFE1F003FFF00001F07FFF000001F0003E00003E007C000003FE0F83FE00003E0003FFF00001F0003E00003E007C000003FE0F83FE00003E0003FFF00001F0003E00003E007C000003FE0F83FE00003E0003FFF00001F0003E00003E007C000003FE0F83FE00003E0003FFF00001FFF801FFF83FF0001FFFFC0000FC01FFFFE1F0003FFF8001FFFC01FFFC3FF0003FFFFC00007C01FFFFC1F0003FFF8001FFFC01FFFC3FF0003FFFFC00007C01FFFFC1F0003FFF8001FFFC01FFFC3FF0003FFFFC00007C01FFFFC1F0003FFF8001FFFC01FFFC3FF0003FFFFC00007C01FFFFC1F0003FFF8001F07FC0007FE0007C000F80000FFFC00F87C00FFFE1FF8001F07FC0007FC0007C000F80000FFFC00F83C00FFFC1FF8001F07FC0007FC0007C000F80000FFFC00F83C00FFFC1FF8001F07FC0007FC0007C000F80000FFFC00F83C00FFFC1FF8001F07FC0007FC0007C000F80000FFFC00F83E00FFFC1FF8000007FC00FFFFE007FFFF07C01FFFC3FF07C01F07C3FF00000007FC00FFFFE007FFFF07C01FFFC3FF07C01F07C3FF00000007FC00FFFFE007FFFF07C01FFFC3FF07C01F07C3FF00000007FC00FFFFE007FFFF07C01FFFC3FF07C01F07C3FF00000007FE00FFFFE007FFFF07C01FFFC3FF07C01F07C3FF00001F07C3FF0003FF00000007FFE0FFFFE0000000003C1F00001F07C3FF0003FF00000007FFE0FFFFE0000000003C1F00001F07C3FF0003FF00000007FFE0FFFFE0000000003C1F00001F07C3FF0003FF00000007FFE0FFFFE0000000003C1F00001F07C3FF0001FF0000000FFFF0FFFFF0000000007C1F00000007FC1FF80000FFFC1FFFFC1F0003FFFFFFFFFFC000F8000007FC1FF80000FFFC1FFFFC1F0003FFFFFFFFFFC000F8000007FC1FF80000FFFC1FFFFC1F0003FFFFFFFFFFC000F8000007FC1FF80000FFFC1FFFFC1F0003FFFFFFFFFFC000F8001FFFC3FF0F801FF80000F803FFFF8000FFFFF0F87C1FF8001FFFC3FF07C01FF80000F803FFFFC000FFFFE0F83C1FF8001FFFC3FF07C01FF80000F803FFFFC000FFFFE0F83C1FF8001FFFC3FF07C01FF80000F803FFFFC000FFFFE0F83C1FF8001FFFC3FF07C01FF80000F803FFFFC000FFFFE0F83C1FF80000FFFFFFF87FFFF83FFFFFFE1FFFC01F07C01F07FFFF000000FFFFFFF83FFFF83FFFFFFC1FFFC01F07C01F07FFFF000000FFFFFFF83FFFF83FFFFFFC1FFFC01F07C01F07FFFF000000FFFFFFF83FFFF83FFFFFFC1FFFC01F07C01F07FFFF000000FFFFFFF83FFFF83FFFFFFC1FFFC01F07C01F07FFFF00001FF83FE007C3E007C0000003E0F83FFF07FFE0000000F8001FF83FE007C3E007C0000003E0F83FFF07FFE0000000F8001FF83FE007C3E007C0000003E0F83FFF07FFE0000000F8001FF83FE007C3E007C0000003E0F83FFF07FFE0000000F8001FF83FE007C3E007C0000003E0F87FFF07FFE0000000F80000F83FFFFFFC00003C1FFFC00007C3E0FFC000FFC3FFF80000F83FFFFFFC00003C1FFFC00007C3E0FFC000FFC3FFF80000F83FFFFFFC00003C1FFFC00007C3E0FFC000FFC3FFF80000F83FFFFFFC00003C1FFFC00007C3E0FFC000FFC3FFF80000F87FFFFFFC00007C1FFFC0000F81E0FF8000FFC3FFF8001FFFFC1F003C0007C000003C00F80000000000F83C1FF8001FFFFC1F003C0007C000003C00F80000000000F83C1FF8001FFFFC1F003C0007C000003C00F80000000000F83C1FF8001FFFFC1F003C0007C000003C00F80000000000F83C1FF8001FFFFC00F803E007FC0007FC1F00001F07801FF803FF00001FFFFC00F803E007FC0007FC1F00001F07C01FF803FF00001FFFFC00F803E007FC0007FC1F00001F07C01FF803FF00001FFFFC00F803E007FC0007FC1F00001F07C01FF803FF00001FFFFC00F803E007FC0007FC1F00001F07C01FF803FF00001F0003E00000000003E0F87FE0FFC00007FC00F83FE0F8001F0003E00000000003E0F83FE0FFC00007FC00F83FE0F8001F0003E00000000003E0F83FE0FFC00007FC00F83FE0F8001F0003E00000000003E0F83FE0FFC00007FC00F83FE0F8001F0003E00000000003E0F83FE0FFC00007FC00F83FE0F8001F007C00F87FFFFFC01FFFC01FF8001FFFFFFFF83FFFF8001F003C00F83FFFFFC01FFFC01FF8001FFFFFFFF83FFFF8001F003C00F83FFFFFC01FFFC01FF8001FFFFFFFF83FFFF8001F003C00F83FFFFFC01FFFC01FF8001FFFFFFFF83FFFF8001F007C00F83FFFFFC01FFFC01FF8001FFFFFFFF83FFFF8001F07C0000003FFF80000F80000FFFC00FFFFE0F83C1FF8001F07C0000003FFF80000F80000FFFC00FFFFE0F83C1FF8001F07C0000003FFF80000F80000FFFC00FFFFE0F83C1FF8001F07C0000003FFF80000F80000FFFC00FFFFE0F83C1FF8001F0780000003FFF80000F80000FFFE00FFFFF0F87E1FF8001F0003E0F83FFFF83C1F07FC1F0003FFFFFFFFFFFFFF00001F0003E0F83FFFF83C1F07FC1F0003FFFFFFFFFFFFFF00001F0003E0F83FFFF83C1F07FC1F0003FFFFFFFFFFFFFF00001F0003E0F83FFFF83C1F07FC1F0003FFFFFFFFFFFFFF000000000000003FF00FC00007C3F0FFFFFF007E000FC000F80000000000003FE007C00007C3E0FFFFFF003C0007C000F80000000000003FE007C00007C3E0FFFFFF003C0007C000F80000000000003FE007C00007C3E0FFFFFF003C0007C000F80000000000003FE007C00007C3E0FFFFFF003C0007C000F8001FFFFFFFF83E00007FFF07FE000003FF003C1F07C3FFF8001FFFFFFFF83C00003FFF07FC000003FF003C1F07C3FFF8001FFFFFFFF83C00003FFF07FC000003FF003C1F07C3FFF8001FFFFFFFF83C00003FFF07FC000003FF003C1F07C3FFF8001FFFFFFFF87C00003FFF07FC000003FF003C1F07C3FFF8001F000000F803FF07C3FFF83FE0FFFFE0FFFC0007FC1F00001F000000F803FF07C3FFF83FE0FFFFE0FFFC0007FC1F00001F000000F803FF07C3FFF83FE0FFFFE0FFFC0007FC1F00001F000000F803FF07C3FFF83FE0FFFFE0FFFC0007FC1F00001F000000F803FF07C3FFF87FE0FFFFE0FFFE0007FE1F00001F07FFE0F83C0007FFE007FC1F003C1F07FFFFFFC3FF00001F07FFE0F83C0007FFE007FC1F003C1F07FFFFFFC3FF00001F07FFE0F83C0007FFE007FC1F003C1F07FFFFFFC3FF00001F07FFE0F83C0007FFE007FC1F003C1F07FFFFFFC3FF00001F07FFE0F83E0007FFE007FE1F007E1F0FFFFFFFC1FF00001F07FFE0F83FE0003FE0003FE0FFFFE0F8001FFFC01FF8001F07FFE0F83FE0003FE0003FE0FFFFE0F8001FFFC01FF8001F07FFE0F83FE0003FE0003FE0FFFFE0F8001FFFC01FF8001F07FFE0F83FE0003FE0003FE0FFFFE0F8001FFFC01FF8001F07FFE0F83FE0FFC3FFFFC000F80000F801F00001FFF8001F07FFE0F83FE0FFC3FFFFC000F80000F803E00003FFF8001F07FFE0F83FE0FFC3FFFFC000F80000F803E00003FFF8001F07FFE0F83FE0FFC3FFFFC000F80000F803E00003FFF8001F07FFE0F83FE0FFC3FFFFC000F80000F803E00003FFF8001F000000F83E1FF803E0F803FFF83C00003FFFF83E00F8001F000000F83C1FF803E0F803FFF83C00003FFFF83C00F8001F000000F83C1FF803E0F803FFF83C00003FFFF83C00F8001F000000F83C1FF803E0F803FFF83C00003FFFF83C00F8001F000000F83C1FF803E0F803FFF87C00003FFFF87C00F8001FFFFFFFF83FE0FFC01F07FC1F0003FF07C3E0F803FFF8001FFFFFFFF83FE0FFC01F07FC1F0003FF07C3E0F803FFF8001FFFFFFFF83FE0FFC01F07FC1F0003FF07C3E0F803FFF8001FFFFFFFF83FE0FFC01F07FC1F0003FF07C3E0F803FFF8001FFFFFFFF83FE0FFC01F07FC1F0003FF07C3E0F803FFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\nEG 11 88 440 594 0000000007ffe00000000000000000ffffff0000000000000007ff00ffe00000000000001fc00003f8000000000000fe0000007f000000000001f00000000f800000000007c000000003e0000000001f0000000000f8000000003c00000000003c000000007800000000001e00000001e000000000000780000003c0000000000003c000000780000000000001e000000f00000000000000f000001e000000000000007800003c000000000000003c000038000000000000001c00007000000c000000000e0000e000000f80000000070001c000001f00000000038001c000003f000000000380038000003e0000000001c0030000007fffffe00000c007000000ffffffc00000e00e000000ffffffc00000700e000001ffffffc00000700c000003f00003c00000301c000007e00003c00000381800000fe00003c00000183800001fffff03c000001c3800000fffff03c000001c300000077fff03c000000c700000027fff03c000000e70000000780f07c000000e60000000780f07c000000660000000780f07c000000660000000780f07c0000006e00000007fff07c0000007e00000007fff07c0000007e00000007fff7f80000007c00000007fff7f80000003c000000078007f80000003c000000078003e00000003c000000078000060000003c000000078000078000003c0000000780000f8000003c00000007c0001f8000003c00000007ffffff8000003e00000007ffffff0000007e00000003fffffe0000007e00000000fffffc0000007600000000000000000000660000000000000000000066000000000000000000006700000000000000000000e700000000000000000000e300000000000000000000c380000000000000000001c380000000000000000001c18000000000018000000181c00fc00000018000000380c00c600000000000000300e00c20c0c8e08983800700e00c63e1f9fd8fc7f00700700fc23331198cc4600e00300fe0331319886c600c00380c33f331998866601c001c0c3731e1f18867c038001c0c3633010188640038000e0fe7f3a1b18866c07000070fc3b1f9fd8847f0e000038000020b0c000c31c00003c000021b0c000c33c00001e00003f1f80007e7800000f00000404000010f000000780000000000001e0000003c0000000000003c0000001e0000000000007800000007800000000001e000000003c00000000003c000000001f0000000000f80000000007c000000003e00000000001f00000000f800000000000fe0000007f0000000000001fc00003f800000000000007ff00ffe000000000000000ffffff000000000000000007ffe000000000\nGAP-SENSE\nFORM\nPRINT\n"
                                }
                            ],
                            "waybillNo": "SF1306210701234"
                        }
                    ],
                    "templateCode": "fm_76130_international_{partnerId}"
                },
                "requestId": "requestId",
                "success": true
            }
            失败响应：
            {
                "apiErrorMsg": "auth_error:partnerID:test010d_is_not_exist",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1011",
                "apiResultData": "{***}"
            }
            响应报文2 文件:

            {
                "obj": {
                    "fileType": "command",
                    "files": [
                        {
                            "areaNo": 1,
                            "documentSize": 0,
                            "pageCount": 0,
                            "pageNo": 1,
                            "seqNo": 1,
                            "token": "AUTH_tkv12_f146d1855480549d262",
                            "url": "https://*.txt",
                            "waybillNo": "SF1630013570307"
                        },
                        {
                            "areaNo": 1,
                            "documentSize": 0,
                            "pageCount": 0,
                            "pageNo": 1,
                            "seqNo": 2,
                            "token": "AUTH_tkv12_f146d18554805",
                            "url": "https://*.txt",
                            "waybillNo": "SF1334476597930"
                        }
                    ],
                    "sysCode": "eos-scp-core",
                    "templateCode": "fm_210_standard_eos-scp-core"
                },
                "requestId": "syd-202307191803",
                "success": true
            }
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明	【处理建议】
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果	
            A1001	必传参数不可为空	serviceCode partnerID requestID timestamp msgDigest msgData 不可为空
            A1002	请求时效已过期	时效参考auth2 https://open.sf-express.com/customerService/395002?interId=590549&faqId=4
            A1003	IP无效	参考常见问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=590549&faqId=2
            A1004	无对应服务权限	联系销售经理，配置权限
            A1005	流量受控	测试环境流量限制为5000，请不要在测试环境做压测
            A1006	数字签名无效	参考常见问题 签名加解密问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=795986
            A1007	重复请求	过一分钟在尝试
            A1008	数据解密失败	
            A1009	目标服务异常或不可达	
            A1099	系统异常	
            3.2 业务异常代码 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_PRINT_COMMAND";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudPrintCommand>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// 云打印面单转菜鸟模板接口 
        /// 该接口将云打印模板转换为菜鸟打印模板，返回填充数据后的模板地址，可直接使用菜鸟打印组件打印或预览。
        /// 之前已接入菜鸟打印组件的打单系统，可对接该方式，降低历史用户切换打印插件和打印机设置成本
        /// 未对接过菜鸟打印组件的系统，推荐使用云打印插件方案
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudPrintCaiNiao(string partnerID, string checkword, MsgDataRequestCloudPrintCaiNiao data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            请求报文1:单票传值举例（msgData字段）:

            {
                "templateCode": "fm_210_standard_{{clientcode}}",
                "version":"2.0",
                "sync":true,
                "documents": [{
                "masterWaybillNo": "SF1234567890999"
                }]
            }
            请求报文2:签回单传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "sync":true,
                "documents": [{
                "masterWaybillNo":"SF1234567890999"},
                {
                "backWaybillNo":"SF1234567890666"}
                ]
            }
            请求报文3:子母单场景传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "sync":true,
                "documents": [{
                "masterWaybillNo":"SF1234567890999",
                "seq":"1",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890100",
                "seq":"2",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890101",
                "seq":"3",
                "sum":"3"}
            ]
            请求报文4:使用自定义模板编辑器场景传值举例

            {
                "templateCode": "fm_76130_standard_{{clientcode}}",
                "customTemplateCode":"fm_76130_standard_custom_10000022213_1",
                "version":"2.0",
                "fileType":"pdf",
                "sync":true,
                "documents": [{
                "masterWaybillNo": "SF1234567890999",
                "customData":{"var123":"自定义变量内容"}
                }]
            }

            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	String	失败提示信息
            3	errorCode	String	失败状态码
            4	requestId	String	发送请求中的ID,原封不动返回，使客户系统能识别出哪个请求对应的响应
            5	obj	object	同步方式才有值，异步方式为空对象
            obj
            #	属性名	类型	说明
            1	files	List<PrintFile>	pdf文件集合,不保证顺序，自行通过seqNo排序
            2	clientCode	String	客户编码
            3	templateCode	String	模板编码
            4	fileType	String	文件类型(cainao)
            PrintFile
            #	属性名	类型	说明
            1	contents	List<content>	每一单的模板文件集合
            2	waybillNo	string	顺丰运单号（子母单则为子单号）
            3	seqNo	int	面单序号（documents的序号）
            content
            #	属性名	类型	说明
            1	templateURL	boolean	菜鸟模板文件的url下载地址
            4	areaNo	int	联编号（单联：1）
            5	pageNo	int	每联的页号(单页：1)
            2.7. 返回示例\应用场景(JSON)示例
            响应报文:

            成功响应-同步:
            {
                "apiErrorMsg": "",
                "apiResponseID": "00018A72825B113FE8A69E8B2E58FA3F",
                "apiResultCode": "A1000",
                "apiResultData": "{\"obj\":{\"clientCode\":\"clientCode\",\"fileType\":\"cainiao\",\"files\":[{\"contents\":[{\"areaNo\":1,\"pageNo\":1,\"templateURL\":\"https://*.xml\"}],\"seqNo\":1,\"waybillNo\":\"SF1234567890123\"}],\"templateCode\":\"fm_76130_standard_clientCode\"},\"requestId\":\"requestId\",\"success\":true}"
            }

            失败响应：
            {
                "apiErrorMsg": "auth_error:partnerID:test010d_is_not_exist",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1011",
                "apiResultData": "{***}"
            }
            3. 菜鸟打印组件接入方案
            3.1 附加文档
            菜鸟打印组件交互协议: https://support-cnkuaidi.taobao.com/doc.htm#?docType=1&docId=107014
            菜鸟打印组件测试网址：http://cdn-cloudprint.cainiao.com/waybill-print/docs/test/test_print.html
            菜鸟打印组件测试报文
            以下报文根据 2.7 返回示例报文 转换而来

            {
                "cmd": "print",
                "requestID": "1234589",
                "version": "1.0",
                "task": {
                    "taskID": "7293666",
                    "preview": false,
                    "printer": "",
                    "notifyMode": "allInOne",
                    "previewType": "pdf",
                    "documents": [{
                        "documentID": "SF20700311231",
                        "contents": [{
                            "templateURL": "https://*.xml"
                        }]
                    },
                    {
                        "documentID": "SF20700311232",
                        "contents": [{
                            "templateURL": "https://*.xml"
                        }]
                    },
                    {
                        "documentID": "SF207003112323",
                        "contents": [{
                            "templateURL": "https://*.xml"
                        }]
                    }]
                }
            }
            4. 错误代码
            4.1 （API）平台结果代码列表
            标识	说明	【处理建议】
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果	
            A1001	必传参数不可为空	serviceCode partnerID requestID timestamp msgDigest msgData 不可为空
            A1002	请求时效已过期	时效参考auth2 https://open.sf-express.com/customerService/395002?interId=590549&faqId=4
            A1003	IP无效	参考常见问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=590549&faqId=2
            A1004	无对应服务权限	联系销售经理，配置权限
            A1005	流量受控	测试环境流量限制为5000，请不要在测试环境做压测
            A1006	数字签名无效	参考常见问题 签名加解密问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=795986
            A1007	重复请求	过一分钟在尝试
            A1008	数据解密失败	
            A1009	目标服务异常或不可达	
            A1099	系统异常	
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_PRINT_CAINIAO";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudPrintCaiNiao>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// 云打印面单转HTML接口
        /// 该接口可同步获取面单的html文件下载地址，接口直接返回面单html文件的url地址，外网下载时需要请求头携带对应token。
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudPrintHtml(string partnerID, string checkword, MsgDataRequestCloudPrintHtml data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            请求报文1:单票传值举例（msgData字段）:

            {
                "templateCode": "fm_210_standard_{{clientcode}}",
                "version":"2.0",
                "fileType":"html",
                "documents": [{
                "masterWaybillNo": "SF1234567890999"
                }]
            }
            请求报文2:签回单传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "fileType":"html",
                "documents": [{
                "masterWaybillNo":"SF1234567890999"},
                {
                "backWaybillNo":"SF1234567890666"}
                ]
            }
            请求报文3:子母单场景传值举例

            {
                    "templateCode": "fm_210_standard_{{clientcode}}",
                    "version":"2.0",
                    "fileType":"html",
                "documents": [{
                "masterWaybillNo":"SF1234567890999",
                "seq":"1",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890100",
                "seq":"2",
                "sum":"3"},
                {
                "masterWaybillNo":"SF1234567890999",
                "branchWaybillNo":"SF2234567890101",
                "seq":"3",
                "sum":"3"}
            ]
            请求报文4:使用自定义模板编辑器场景传值举例

            {
                "templateCode": "fm_76130_standard_{{clientcode}}",
                "customTemplateCode":"fm_76130_standard_custom_10000022213_1",
                "version":"2.0",
                "fileType":"html",
                "documents": [{
                "masterWaybillNo": "SF1234567890999",
                "customData":{"var123":"自定义变量内容"}
                }]
            }

            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	String	失败提示信息
            3	errorCode	String	失败状态码
            4	requestId	String	发送请求中的ID,原封不动返回，使客户系统能识别出哪个请求对应的响应
            5	obj	object	业务数据
            obj
            #	属性名	类型	说明
            1	files	List<PrintFile>	html文件集合,不保证顺序，自行通过seqNo排序
            2	clientCode	String	客户编码
            3	templateCode	String	模板编码
            4	fileType	String	文件类型(html)
            PrintFile
            #	属性名	类型	说明
            1	url	String	html文件的url下载地址,使用 GET 协议
            2	token	String	下载文件时需要的token,设置在请求头的 X-Auth-token 字段，有效期 24h
            3	waybillNo	String	顺丰运单号（子母单为子单号）
            4	seqNo	int	面单序号（批量打印场景，为documents的序号）
            5	areaNo	int	联编号（大客户面单为固定值：1）
            5	pageNo	int	每联的页号(大客户面单为固定值：1)
            2.7. 返回示例\应用场景(JSON)示例
            响应报文:

            成功响应:
            {
                "apiErrorMsg": "",
                "apiResponseID": "000189F87B1B193FE3DE5E798D07183F",
                "apiResultCode": "A1000",
                "apiResultData": "{\"obj\":{\"clientCode\":\"SLKJNH0b5Xc\",\"fileType\":\"html\",\"files\":[{\"areaNo\":1,\"documentSize\":0,\"pageCount\":0,\"pageNo\":1,\"seqNo\":1,\"token\":\"AUTH_tkv12_f146d1855480549d262b5c46ab0a***c608f9725bcd2\",\"url\":\"https://eos-scp-core-shenzhen-futian1-oss.sf-express.com:443/v1.2/AUTH_EOS-SCP-CORE/print-file/SLKJ***b5Xc_dqx-test-06102056_SF1687***931891_fm_76130_standard_SLKJ***b5Xc_1_1_1.html\",\"waybillNo\":\"SF1687***931891\"}],\"templateCode\":\"fm_76130_standard_SLKJ***b5Xc\"},\"requestId\":\"dqx-test-06102056\",\"success\":true}"
            }


            - 失败响应：

            ```json
            {
                "apiErrorMsg": "auth_error:partnerID:test010d_is_not_exist",
                "apiResponseID": "00016ABEC9ECCB3FE1C04106BA87EF3F",
                "apiResultCode": "A1011",
                "apiResultData": "{***}"
            }
            3. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明	【处理建议】
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果	
            A1001	必传参数不可为空	serviceCode partnerID requestID timestamp msgDigest msgData 不可为空
            A1002	请求时效已过期	时效参考auth2 https://open.sf-express.com/customerService/395002?interId=590549&faqId=4
            A1003	IP无效	参考常见问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=590549&faqId=2
            A1004	无对应服务权限	联系销售经理，配置权限
            A1005	流量受控	测试环境流量限制为5000，请不要在测试环境做压测
            A1006	数字签名无效	参考常见问题 签名加解密问题 https://open.sf-express.com/customerService/395002?activeIndex=905584&interId=795986
            A1007	重复请求	过一分钟在尝试
            A1008	数据解密失败	
            A1009	目标服务异常或不可达	
            A1099	系统异常	
            3.2 业务异常代码 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_PRINT_HTML";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudPrintHtml>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// ISV获取商家自定义模板列表
        /// 提供给ISV查询商家发布的自定义模板列表数据,包括自定义模板使用的打印项
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudCustomTemplateList(string partnerID, string checkword, MsgDataRequestCloudCustomTemplateList data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            {
                "standardTemplateCode":"fm_76130_standard",
                "sellerUserId":"123",
                "type":1
            }
            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	string	失败提示信息
            3	errorCode	string	失败状态码
            4	requestId	string	发送请求中的ID,原封不动返回，使客户系统能识别出哪个请求对应的响应
            5	obj	List<CustomTemplateDTO>	自定义模板列表
            CustomTemplateDTO

            #	属性名	类型(约束)	必填	描述
            1	customTemplateName	String(30)	是	自定义模板名称
            2	customTemplateCode	List	是	自定义模板编码
            3	standardTemplateCode	String(1000)	是	标准模板code
            4	placeholderKeys	String(1000)	否	打印项字段列表
            2.7. 返回示例\应用场景(JSON)示例

            {
                "obj": [
                    {
                        "customTemplateCode": "fm_76130_standard_custom_10000085012_1",
                        "customTemplateName": "130自定义模板1",
                        "placeholderKeys": [
                            "students"
                        ],
                        "standardTemplateCode": "fm_76130_standard"
                    },
                    {
                        "customTemplateCode": "fm_76130_standard_custom_10000085012_2",
                        "customTemplateName": "130自定义模板2",
                        "placeholderKeys": [
                            "gname",
                            "students",
                            "sf_willbillNo"
                        ],
                        "standardTemplateCode": "fm_76130_standard"
                    }
                ],
                "requestId": "2203251530",
                "success": true
            }
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果
            A1001	必传参数不可为空
            A1002	请求时效已过期
            A1003	IP无效
            A1004	无对应服务权限
            A1005	流量受控
            A1006	数字签名无效
            A1007	重复请求
            A1008	数据解密失败
            A1009	目标服务异常或不可达
            A1099	系统异常
            3.2 业务异常代码 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_CUSTOMTEMPLATE_LIST";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudCustomTemplateList>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// ISV保存自定义模板接口
        /// 提供给ISV保存自定义模板,需要按照标记语言规范保存
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudCustomTemplateSave(string partnerID, string checkword, MsgDataRequestCloudCustomTemplateSave data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            {
                "standardTemplateCode":"fm_76130_standard",
                "sellerUserId":"12345",
                "customTemplateName":"丰密130自定义模板",	
                    "content":"[{\n"+
                        "\"type\": \"line\",\n"+
                        "\"top\": \"38\",\n"+
                        "\"left\": \"1\",\n"+
                        "\"width\": \"96\"\n"+
                        "},{\n"+
                        "\"value\": \"已验视\",\n"+
                        "\"type\": \"text\",\n"+
                        "\"left\": \"66\",\n"+
                        "\"top\": \"64\",\n"+
                        "\"width\": \"10\",\n"+
                        "\"height\": \"27\",\n"+
                        "\"fontSize\": \"20\",\n"+
                        "\"fontName\": \"黑体\"\n"+
                        "}]"
            }
            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	string	失败提示信息
            3	errorCode	string	失败状态码
            4	obj	json	业务响应数据对象
            obj

            #	属性名	类型(约束)	必填	描述
            1	customTemplateCode	string	是	自定义模板编码
            2.7. 返回示例\应用场景(JSON)示例

            {
                "obj":{
                        "customTemplateCode": "fm_76130_standard_custom_10000085012_1"
                },
                "success": true
            }
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果
            A1001	必传参数不可为空
            A1002	请求时效已过期
            A1003	IP无效
            A1004	无对应服务权限
            A1005	流量受控
            A1006	数字签名无效
            A1007	重复请求
            A1008	数据解密失败
            A1009	目标服务异常或不可达
            A1099	系统异常
            3.2 业务异常代码 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_CUSTOMTEMPLATE_SAVE";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudCustomTemplateSave>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        resultdata = JsonHelper.SerializeObject(msgDataResponse.obj);
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        /// <summary>
        /// ISV删除自定义模板接口
        /// 提供给ISV删除用户的自定义模板,系统有限制每个用户可使用的模板总数，如果超过限制，需要先删除历史不用的模板，才可以新增模板
        /// </summary>
        /// <param name="partnerID"></param>
        /// <param name="checkword"></param>
        /// <param name="data">业务数据报文 json字符串</param>
        /// <param name="environment">调用环境，bspgw：生产环境；sfapi-hk：香港生产环境；sfapi-sbox：沙箱环境</param>
        /// <returns></returns>
        public static JsonResult CloudCustomTemplateDelete(string partnerID, string checkword, MsgDataRequestCloudCustomTemplateDelete data, string accessToken = "", string environment = "bspgw")
        {
            /*
            2.6. 请求示例\应用场景(JSON)示例
            {
                "sellerUserId":"12345",
                "customTemplateCode": "fm_76130_standard_custom_10000085012_1"
            }	
            2.4. 公共响应参数
            #	属性名	类型(约束)	必填	默认值	描述
            1	apiResultCode	String	是		API平台结果代码
            2	apiErrorMsg	String	否		API平台异常信息
            3	apiResponseID	String	是		API响应唯一号UUID
            4	apiResultData	String	否		业务处理详细结果
            2.5. 响应参数<apiResultData>
            #	属性名	类型	说明
            1	success	boolean	请求成功标志
            2	errorMessage	string	失败提示信息
            3	errorCode	string	失败状态码
            2.7. 返回示例\应用场景(JSON)示例

            {
                "requestId": "2203251530",
                "success": true
            }
            3.1. 错误代码
            3.1 （API）平台结果代码列表
            标识	说明
            A1000	统一接入平台校验成功，调用后端服务成功； 注意：不代表后端业务处理成功，实际业务处理结果， 需要查看响应属性apiResultData中的详细结果
            A1001	必传参数不可为空
            A1002	请求时效已过期
            A1003	IP无效
            A1004	无对应服务权限
            A1005	流量受控
            A1006	数字签名无效
            A1007	重复请求
            A1008	数据解密失败
            A1009	目标服务异常或不可达
            A1099	系统异常 
            */
            string errcode = "";
            string errmsg = "";
            string resultdata = "";

            string serviceCode = "COM_RECE_CLOUD_CUSTOMTEMPLATE_DELETE";
            string msgData = SFCommon.JsonCompress(JsonHelper.SerializeObject(data));
            string timestamp = SFCommon.GetTimeStamp(); //获取时间戳
            string requestID = Guid.NewGuid().ToString(); //获取uuid

            Dictionary<string, string> content = new Dictionary<string, string>();
            content["partnerID"] = partnerID;
            content["requestID"] = requestID;
            content["serviceCode"] = serviceCode;
            content["timestamp"] = timestamp;
            if (!string.IsNullOrWhiteSpace(accessToken))
            {
                content["accessToken"] = accessToken;
            }
            else
            {
                string msgDigest = SFCommon.MD5ToBase64String(SFCommon.UrlEncode(msgData + timestamp + checkword));
                content["msgDigest"] = msgDigest;
            }
            content["msgData"] = msgData;

            var result = HttpHelper.GetResponseApiResultData(content, null, environment);
            if (result != null)
            {
                if (result.apiResultCode == "A1000")
                {
                    var msgDataResponse = JsonHelper.DeserializeObject<MsgDataResponseCloudCustomTemplateDelete>(result.apiResultData);
                    if (msgDataResponse != null)
                    {
                        errmsg = msgDataResponse.errorMessage;
                        if (msgDataResponse.success)
                        {
                            errcode = "0";
                        }
                        else
                        {
                            errcode = msgDataResponse.errorCode;
                        }
                    }
                    else
                    {
                        errcode = "-2";
                        errmsg = "未返回业务数据";
                        resultdata = "";
                    }
                }
                else
                {
                    errcode = result.apiResultCode;
                    errmsg = result.apiErrorMsg;
                    resultdata = result.apiResultData;
                }
            }
            else
            {
                errcode = "-1";
                errmsg = "接口未返回内容";
                resultdata = "";
            }

            return new JsonResult
            {
                errcode = errcode,
                errmsg = errmsg,
                data = resultdata
            };
        }

        #endregion 面单类接口
    }
}
